﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WorkingFileManager
{
    /// <summary>
    /// Before the program exits or a new file is opened, we may need to ask the user if they want to save the current
    /// working file. This class contains parameters about what to do if that happens. This will be part of the
    /// OpenFile and Exit messages.
    /// </summary>
    public class SaveFileInfo
    {
        /// <summary>
        /// Indicates the default starting location of the save dialog if the user needs to save.
        /// </summary>
        public string InitialDirectory;

        /// <summary>
        /// The file filter string to use in the save dialog if the user needs to save.
        /// </summary>
        public string Filter;

        /// <summary>
        /// This action contains code that should be called if the working file (the file
        /// specified in currentWorkingFile) is saved before we proceed to the main operation.
        /// </summary>
        public Action<string> WorkingFileSaveCallback;

        /// <summary>
        /// Indicates if the use should be asked if they want to save changes before
        /// being allowed to open a new file. If this is true, there is a possibility that
        /// WorkingFileSaveCallBack will be called.
        /// Usually this will be supplied by a WorkingFileState.
        /// </summary>
        public bool promptSaveChanges;

        /// <summary>
        /// Indicates the filename of the current file that is loaded in the program, or null or empty
        /// if no file is loaded. This is used when promptSaveChanges is true. When that is true
        /// the recipient of this message should ask the user if they want to save changes. If they do,
        /// and this string is populated, we can save to that file (by calling WorkingFileSaveCallback). 
        /// If this string is not populated, we have to display a SaveFileDialog to gather a target
        /// filename to save to, and then call WorkingFileSaveCallback with it as a parameter.
        /// </summary>
        public string currentWorkingFile;

        /// <summary>
        /// Text displayed as the titlebar of the message box if we ask the user if they want
        /// to save changes before continuing.
        /// </summary>
        public string saveChangesPopupTitle;

        /// <summary>
        /// Text displayed within message box if we ask the user if they want
        /// to save changes before continuing.
        /// </summary>
        public string saveChangesPopupText;
    }
}
